# -*- coding: utf-8 -*-
# @Time: 2025/9/21 2:59
# @Author: foxhuty
# @File: timer.py
from functools import wraps
import time

def async_timer(func):
    @wraps(func)
    async def wrapper(*args, **kwargs):
        print(f"函数 {func.__name__} 开始执行.参数：{args}, {kwargs}")
        start_time = time.time()
        # result = await func(*args, **kwargs)
        try:
            return await func(*args, **kwargs)
        finally:
            end_time = time.time()
            time_used = end_time - start_time
            print(f"函数 {func.__name__} 执行时间: {time_used:.2f} 秒")

    return wrapper
